import axios from '../utils/axios'

// 数据上传记录相关API
export const dataUploadApi = {
  // 获取上传记录列表
  getUploadRecordList(params = {}) {
    return axios.get('/data-upload/records', { params })
  },

  // 根据ID获取上传记录
  getUploadRecordById(id) {
    return axios.get(`/data-upload/records/${id}`)
  },

  // 删除上传记录
  deleteUploadRecord(id) {
    return axios.delete(`/data-upload/records/${id}`)
  },

  // 批量删除上传记录
  batchDeleteUploadRecords(ids) {
    return axios.post('/data-upload/records/batch-delete', { ids })
  },

  // 获取上传统计信息
  getUploadStatistics(params = {}) {
    return axios.get('/data-upload/statistics', { params })
  },

  // 重新处理上传记录
  reprocessUploadRecord(id) {
    return axios.post(`/data-upload/records/${id}/reprocess`)
  },

  // 获取文件预览信息
  getFilePreview(id) {
    return axios.get(`/data-upload/records/${id}/preview`)
  },

  // 下载上传的文件
  downloadUploadedFile(id) {
    return axios.get(`/data-upload/records/${id}/download`, {
      responseType: 'blob'
    })
  },

  // 获取上传进度
  getUploadProgress(uploadId) {
    return axios.get(`/data-upload/progress/${uploadId}`)
  }
}
